$webwork.htmlEncode($page.space.name) : Custom projection definition in PostGIS
This page last changed on Oct 20, 2006 by aaime.
Custom projection definition in PostGis.Sometimes we need to store geometries that are in a projection which is not defined in the spatial_sys_ref PostGis table. For example, recently I needed to store geometries which were projected in a Lambert Conformal Conic projection with the following parameters: Projection parameters (as reported in QGis) PROJCS[ "unnamed ",GEOGCS[ "WGS 84 ",DATUM[ "WGS_1984 ", SPHEROID[ "WGS 84 ",6378137,298.2572235629972,AUTHORITY[ "EPSG ", "7030 "]],AUTHORITY[ "EPSG ", "6326 "]], PRIMEM[ "Greenwich ",0],UNIT[ "degree (supplier to define representation) ",0.01745329251994328],AUTHORITY[ "EPSG ", "4326 "]], PROJECTION[ "Lambert_Conformal_Conic_2SP "], PARAMETER[ "standard_parallel_1 ",33.00000000000004], PARAMETER[ "standard_parallel_2 ",45.00000000000004], PARAMETER[ "latitude_of_origin ",40.00333786010746], PARAMETER[ "central_meridian ",-97.0000000000001], PARAMETER[ "false_easting ",0], PARAMETER[ "false_northing ",0],UNIT[ "metre ",1,AUTHORITY[ "EPSG ", "9001 "]]] To store the parameters for this projection in the spatial_ref_sys table, I created the following INSERT statement: INSERT INTO "spatial_ref_sys" (srid, auth_name, auth_srid, srtext, proj4text) VALUES (104307, 'WRF',104307, 'PROJCS["WRF_Lambert_Conformal_Conic 2",GEOGCS["GCS_North_American_1983", DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.25722356300003]], PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943299]], PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",0], PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-97],PARAMETER["Standard_Parallel_1",33], PARAMETER["Standard_Parallel_2",60],PARAMETER["Latitude_Of_Origin",40.0],UNIT["Meter",1]]','+proj=lcc +lat_1=33 +lat_2=45 +lat_0=40.0 +lon_0=-97.0 +x_0=0 +y_0=0 +ellps=WGS84 +units=m'); The srid code ( in thsi case, 104307) was just the next available in the srid sequence. create table contours (gid serial); select AddGeometryColumn('burn','contours','geom','104306','MULTILINESTRING',2); INSERT INTO contours(gid,geom) VALUES(9, GeometryFromText('MULTILINESTRING ((1633500.0 251214.30448187666,1645746.4486482088 256500.0,1633500.0 266307.86663788836))', 104307) ); |
Document generated by Confluence on Jan 16, 2008 23:27 |